import 'package:flutter/material.dart';

class HomeRoute extends StatefulWidget{
  @override
  State<StatefulWidget> createState()=>_HomeRouteState();
  
}

class _HomeRouteState extends State<HomeRoute> with SingleTickerProviderStateMixin{
  late TabController _tabController; //需要定义一个Controller
  List tabs = ["新闻", "历史", "图片"];
  @override
  void initState() {
    super.initState();
    // 创建Controller  
    _tabController = TabController(length: tabs.length, vsync: this);
  }
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar:AppBar(
        title: Text('今日头条'),
        bottom: TabBar(
          controller: _tabController,
          tabs: tabs.map((e) => Tab(text: e)).toList()),
        ),
      body: Container(),
    );
  }

}